﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DVRMS_Renamer
{
    public partial class frmSelectSeries : Form
    {
        List<TvdbLib.Data.TvdbSearchResult> tvdbResults;
        public int id;

        public frmSelectSeries(List<TvdbLib.Data.TvdbSearchResult> ThetvdbResults)
        {
            InitializeComponent();

            tvdbResults = ThetvdbResults;
        }

        private void frmSelectSeries_Load(object sender, EventArgs e)
        {
            lstSeries.Items.Clear();

            for (int i = 0; i < tvdbResults.Count; i++)
            {
                lstSeries.Items.Add(tvdbResults[i].SeriesName);
            }

            lstSeries.SelectedIndex = 0;
        }

        private void lstSeries_SelectedIndexChanged(object sender, EventArgs e)
        {
            lblSeriesName.Text = tvdbResults[lstSeries.SelectedIndex].SeriesName;
            lblDescription.Text = tvdbResults[lstSeries.SelectedIndex].Overview;
        }

        private void cmdOK_Click(object sender, EventArgs e)
        {
            id = tvdbResults[lstSeries.SelectedIndex].Id;
            this.Close();
        }

        private void lstSeries_DoubleClick(object sender, EventArgs e)
        {
            cmdOK_Click(null, null);
        }
    }
}
